<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin_Pattern extends Controller_Admin_Base
{
    public function action_delete()
    {  
        $pattern_id = $this->request->param('id') ? $this->request->param('id') : null;
        $pattern = ORM::factory('pattern', $pattern_id); 
            
        if (!Model_User::check_role(Model_User::ROLE_ADMIN)) {
            throw new Controller_Exception('У вас нет прав');   
        }
        
        $pattern->delete();
        Request::current()->redirect(Request::current()->referrer());
    }
} 
